package com.wqc;

import com.wqc.tx.User;
import com.wqc.tx.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TxPfbTest {

    public static void main(String[] args) throws Exception {

        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles","true");

        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring/txPfbApplicationContext.xml");
        /*
         * 一定要注入代理类:因为代理类进行增强的操作
         */
        UserService userService = (UserService) ctx.getBean("userServiceProxy");
        User user = new User();
        user.setName("张三");
        user.setAge(12);
        user.setSex("男");
        userService.save(user);
    }

}
